namespace ScrumSprintMonitor.Modules.WorkItemMonitor.ViewModels
{
	#region #using Directives

	using UI.Wpf.ViewModels;

	#endregion

	public class WorkItemCountPieChartData : WorkItemPieChartData,
	                                         IWorkItemCountPieChartData
	{
		private IWorkItemHoursPieChartData timeDimension;

		static WorkItemCountPieChartData()
		{
			var dependsOn = Register<WorkItemCountPieChartData>();

			dependsOn.Call(me => me.OnPropertyChanged("AverageTimePerItem")).OnChanged(me => me.TimeDimension.Value).OnChanged(me => me.Value);
		}

		#region IWorkItemCountPieChartData Members

		public IWorkItemHoursPieChartData TimeDimension
		{
			get { return this.timeDimension; }
			set
			{
				if (value != this.timeDimension)
				{
					this.timeDimension = value;

					OnPropertyChanged("TimeDimension");
				}
			}
		}

		public double AverageTimePerItem
		{
			get { return TimeDimension.Value / Value; }
		}

		#endregion
	}
}